package com.shop.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.shop.mapper.Oms_Order_Setting_Mapper;
import com.shop.pojo.oms.Oms_Order_Setting;
import com.shop.service.Oms_Order_Setting_Service;
import com.shop.utils.LayuiUtils;
import com.shop.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * 订单的配置时间问题
 */
@Service
public class Oms_Order_Setting_ServiceImpl extends ServiceImpl<Oms_Order_Setting_Mapper, Oms_Order_Setting> implements Oms_Order_Setting_Service {

    @Autowired
    private Oms_Order_Setting_Mapper oms_order_setting_mapper;

    /**
     * 订单的显配置示所有信息
     *
     * @param pages
     * @param os
     * @return
     */
    @Override
    public LayuiUtils<Oms_Order_Setting> find_admin_order_setting_All(Page<Oms_Order_Setting> pages, Oms_Order_Setting os) {
        LayuiUtils<Oms_Order_Setting> layuis = new LayuiUtils<>();

        QueryWrapper<Oms_Order_Setting> query = new QueryWrapper<>();

        Page<Oms_Order_Setting> oms_order_settingPage = oms_order_setting_mapper.selectPage(pages, query);
        layuis.setData(oms_order_settingPage.getRecords());
        layuis.setCount(oms_order_settingPage.getTotal());

        return layuis;
    }

    /***
     * 订单的配置时间修改问题
     * @param os
     * @return
     */
    @Override
    public R up_admin_order_setting_All(Oms_Order_Setting os) {

        boolean b = this.updateById(os);

        if(b == true){
            return R.success();
        }
        return R.error(500,"修改失败");
    }

    /***
     * 查询订单的配置信息进行显示
     * @param id
     * @return
     */
    @Override
    public Oms_Order_Setting find_admin_Setting_Dan(Long id) {

        return oms_order_setting_mapper.selectById(id);
    }


}
